package org.hhchat.leetcode.array;

import java.util.ArrayList;
import java.util.List;

/**
 * Created this one by HMH on 2017/10/3.
 */
public class code448_easy {
    static class Solution {
        public List<Integer> findDisappearedNumbers(int[] nums) {
            List<Integer> ret = new ArrayList<Integer>();

            for(int i = 0; i < nums.length; i++) {
                int val = Math.abs(nums[i]) - 1;
                if(nums[val] > 0) {
                    nums[val] = -nums[val];
                }
            }

            for(int i = 0; i < nums.length; i++) {
                if(nums[i] > 0) {
                    ret.add(i+1);
                }
            }
            return ret;
        }
    }
}
